package mk.jug.academy.factory;

import mk.jug.academy.model.Content;
import mk.jug.academy.model.Course;
import mk.jug.academy.model.Event;
import mk.jug.academy.model.Lecturer;
import mk.jug.academy.model.Sponsor;
import mk.jug.academy.model.Student;
import mk.jug.academy.model.Supporter;

/**
 * Factory-like class for creating different {@link Event} instances.
 *
 * @author Ice.Penov
 */
public final class EventFactory {
		
	/** No instantiation. Static usage only */
	private EventFactory() {;}
	
	/** An event created when a course has been started by a lecturer. */
	public static Event createCourseCreationEvent(Course course, Lecturer lecturer) {
		Event event = new Event();
		event.setMessage("Lecturer <b>" + lecturer.getDisplayName() + "</b> has started designing a new course <b>'" + course + "'</b>");
		return event;
	}
	
	/** An event created when a course has been hatched by a lecturer, and is not available. */
	public static Event createCourseHatchingEvent(Course course, Lecturer lecturer) {
		Event event = new Event();
		event.setMessage("Lecturer <b>" + lecturer.getDisplayName() + "</b> has hatched the course <b>'" + course.getTitle() + "'</b>. This course is now available!");
		return event;
	}
	
	/** An event created when a course has been officially started. */
	public static Event createCourseStartEvent(Course course) {
		Event event = new Event();
		event.setMessage("New iteration of the course <b>'" + course.getTitle() + "'</b> has officially started. Happy learning!");
		return event;
	}
	
	/** An event created when a blog is published. */
	public static Event createBlogCreationEvent(Content content) {
		Event event = new Event();
		event.setMessage("A blog titled <b>'" + content.getTitle() + "'</b> was created by <b>" + content.getCreatorDisplayName() + "</b>.");
		return event;
	}
	
	/** An event created when lecturer is approved. */
	public static Event approveLecturerEvent(Lecturer lecturer) {
		Event event = new Event();
		event.setMessage("New lecturer has joined the Academy. Welcome <b>" + lecturer.getDisplayName() + "</b>!");
		return event;
	}
	
	/** An event created when sponsor is accepted. */
	public static Event acceptSponsorEvent(Sponsor sponsor) {
		Event event = new Event();
		event.setMessage("New sponsor has joined the Academy. Thank you, <b>" + sponsor.getDisplayName() + "</b>!");
		return event;
	}
	
	/** An event created when student is accepted. */
	public static Event acceptStudentEvent(Student student) {
		Event event = new Event();
		event.setMessage("New student has signed up. Happy learning, <b>" + student.getDisplayName() + "</b>!");		
		return event;
	}
	
	/** An event created when supporter is accepted. */
	public static Event acceptSupporterEvent(Supporter supporter) {
		Event event = new Event();
		event.setMessage("<b>" + supporter.getDisplayName() + "</b> supports the Academy. Thank you!");
		return event;
	}
	
}